home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / esc.jar / com / extensibility / xa / SchemaWin$EditTextDialog.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-30  |  3.6 KB  |  91 lines

  1. package com.extensibility.xa;
  2.  
  3. import com.extensibility.app.DialogFactory;
  4. import com.extensibility.app.UI;
  5. import com.extensibility.xml.BaseDeclaration;
  6. import com.extensibility.xml.DTDUtilities;
  7. import com.extensibility.xml.InternalPEDeclaration;
  8. import com.extensibility.xml.ParserException;
  9. import java.util.Enumeration;
  10.  
  11. public class SchemaWin$EditTextDialog extends TextCellDialog {
  12.    // $FF: synthetic field
  13.    final SchemaWin this$0;
  14.  
  15.    public SchemaWin$EditTextDialog(SchemaWin var1, SchemaDoc var2, boolean var3) {
  16.       super(var1, var2, (BaseDeclaration)null, var3, (String)null);
  17.       this.this$0 = var1;
  18.       ((CellDialog)this).setURI(((CellDialog)this).getSchemaDoc().getFocusedURI(true));
  19.    }
  20.  
  21.    public SchemaWin$EditTextDialog(SchemaWin var1, SchemaDoc var2, boolean var3, String var4) {
  22.       super(var1, var2, (BaseDeclaration)null, var3, (String)null);
  23.       this.this$0 = var1;
  24.       if (var4 != null) {
  25.          ((CellDialog)this).setText(var4);
  26.          super.orgValue = var4;
  27.       }
  28.  
  29.    }
  30.  
  31.    protected void doDelete() {
  32.       String var1 = ((CellDialog)this).getCellOwner();
  33.       SchemaDoc var2 = ((CellDialog)this).getSchemaDoc();
  34.       InternalPEDeclaration var3 = (InternalPEDeclaration)var2.getNamedDeclaration(DTDUtilities.convertPEName(var1, false), Class.forName("com.extensibility.xml.InternalPEDeclaration"));
  35.       if (!var2.isEditable(var3)) {
  36.          DialogFactory.stop(this, UI.getString("stop.foreign.uri", ((BaseDeclaration)var3).getURI().getFullName()));
  37.       } else {
  38.          Enumeration var4 = var2.getUsedBy(var3);
  39.          if (var4.hasMoreElements()) {
  40.             String var6 = UI.getString("stop.delete.in.use", var1, ((BaseDeclaration)var4.nextElement()).getName());
  41.             DialogFactory.stop(this, var6);
  42.          } else {
  43.             boolean var5 = DialogFactory.showConfirm(this, UI.getString("dialog.delete.pe", var1), UI.getString("dialog.delete"));
  44.             if (var5) {
  45.                var2.removeDeclaration(var3);
  46.                super.doDelete();
  47.             }
  48.          }
  49.       }
  50.    }
  51.  
  52.    protected boolean doSave() {
  53.       try {
  54.          if (!super.doSave()) {
  55.             boolean var8 = false;
  56.             return var8;
  57.          } else {
  58.             String var1 = ((CellDialog)this).getCellOwner();
  59.             SchemaDoc var9 = ((CellDialog)this).getSchemaDoc();
  60.             if (((CellDialog)this).getMode() == 1) {
  61.                var1 = DTDUtilities.convertPEName(var1, false);
  62.                if (var9.getNamedDeclaration(var1, Class.forName("com.extensibility.xml.InternalPEDeclaration")) != null) {
  63.                   throw new ParserException(206, var1);
  64.                }
  65.  
  66.                InternalPEDeclaration var3 = new InternalPEDeclaration(var1, ((CellDialog)this).getText());
  67.                var9.ensureURI(var3);
  68.                var9.insertDeclaration(var3, (BaseDeclaration)null);
  69.             } else {
  70.                var1 = DTDUtilities.convertPEName(var1, false);
  71.                InternalPEDeclaration var10 = (InternalPEDeclaration)var9.getNamedDeclaration(var1, Class.forName("com.extensibility.xml.InternalPEDeclaration"));
  72.                if (!var9.isEditable(var10)) {
  73.                   DialogFactory.stop(this, UI.getString("stop.foreign.uri", ((BaseDeclaration)var10).getURI().getFullName()));
  74.                   boolean var11 = false;
  75.                   return var11;
  76.                }
  77.  
  78.                var10.setValue(((CellDialog)this).getText());
  79.             }
  80.  
  81.             boolean var4 = true;
  82.             return var4;
  83.          }
  84.       } catch (ParserException var5) {
  85.          DialogFactory.showValidation(this, var5.getMessage(), false);
  86.          boolean var2 = false;
  87.          return var2;
  88.       }
  89.    }
  90. }
  91.